Skip to content

[WIP] Refactor entrypoint.sh by extracting initialization phases into functions#5285

Merged
lpcox merged 3 commits into
mainfrom
copilot/refactor-initialization-phases
Jun 19, 2026
Merged

[WIP] Refactor entrypoint.sh by extracting initialization phases into functions#5285
lpcox merged 3 commits into
mainfrom
copilot/refactor-initialization-phases

Conversation

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor
  • Inspect current entrypoint phases and test coverage
  • Run existing build/tests to establish baseline
  • Extract initialization phases in containers/agent/entrypoint.sh into named functions with no behavior change
  • Add or update focused tests for the refactor
  • Run targeted validation and security review
  • Finalize and summarize changes

Copilot AI requested a review from lpcox June 19, 2026 15:52
@lpcox

lpcox commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

@copilot merge main

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot merge main

Addressed in b71c055.

Copilot finished work on behalf of lpcox June 19, 2026 18:28
@lpcox lpcox marked this pull request as ready for review June 19, 2026 18:42
Copilot AI review requested due to automatic review settings June 19, 2026 18:42
@github-actions

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 97.54% 97.58% 📈 +0.04%
Statements 97.47% 97.50% 📈 +0.03%
Functions 98.85% 98.85% ➡️ +0.00%
Branches 92.87% 92.91% 📈 +0.04%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/workdir-setup.ts 92.7% → 94.5% (+1.82%) 92.7% → 94.5% (+1.82%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the agent container entrypoint (containers/agent/entrypoint.sh) by extracting its initialization phases into named functions and introducing a simple structural test intended to ensure the phased main() orchestration remains intact.

Changes:

  • Extracted entrypoint phases (banner, identity setup, DNS/SSL, health checks, logging, capability selection, dispatch) into dedicated bash functions and added a main() orchestrator.
  • Split execution paths into run_chroot_command vs run_non_chroot_command, with main() deciding based on AWF_CHROOT_ENABLED.
  • Added a new shell test (tests/entrypoint-phase-functions.test.sh) that checks for required function definitions and call ordering within main().
Show a summary per file
File Description
containers/agent/entrypoint.sh Refactors entrypoint into discrete phase functions and adds main() to orchestrate the sequence and chroot/non-chroot dispatch.
tests/entrypoint-phase-functions.test.sh Adds a structural smoke test to verify function presence and call ordering in main().

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

Comment on lines +1 to +5
#!/bin/bash
set -e

ENTRYPOINT="$(dirname "$0")/../containers/agent/entrypoint.sh"

@github-actions

Copy link
Copy Markdown
Contributor

⏳ Copilot review left inline comments.

@copilot To proceed:

  1. Ask @copilot to address the review feedback (reply to this comment or the review thread)
  2. Once the fix is pushed, add the ready-for-aw label to trigger agentic CI smoke tests

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude failed

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Security Guard failed. Please review the logs for details.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

Smoke test completed with partial failures. Results reported in PR comment.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct Mode) — PASS

Running in direct BYOK mode via COPILOT_PROVIDER_API_KEY with api-proxy sidecar → api.githubcopilot.com

Test Status
GitHub MCP connectivity
github.com HTTP 200
File write/read
BYOK inference path

All systems nominal.

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results — PASS

Test Result
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read

PR: [WIP] Refactor entrypoint.sh by extracting initialization phases into functions
Author: @Copilot | Assignees: @lpcox @Copilot

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor

🔥 Smoke Test: Copilot PAT — PASS

Test Result
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read

Overall: PASS · Auth mode: PAT (COPILOT_GITHUB_TOKEN)

cc @lpcox @Copilot

🔑 PAT report filed by Smoke Copilot PAT

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test: FAIL

  • chore: upgrade gh-aw to v0.80.6 and recompile workflows (#5294)
  • fix(api-proxy): 403 for terminal caps; fix Anthropic/Copilot input credits (#5271)
  • GitHub read via required CLI: unavailable (safeinputs-gh/gh missing)
  • Playwright: ✅ GitHub title verified
  • File write/read: ✅ /tmp/gh-aw/agent/smoke-test-codex-27844366331.txt
  • Build: ✅ npm ci && npm run build
  • Overall: FAIL

🔮 The oracle has spoken through Smoke Codex

@github-actions

Copy link
Copy Markdown
Contributor

Gemini Engine Smoke Test

  • GitHub MCP Testing: ❌ (MCP tools unavailable)
  • GitHub.com Connectivity: ❌ (SSL/Squid error)
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅

Overall status: FAIL

Recently Merged PRs:

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Status Notes
1. Module Loading otel.js loads successfully; exports: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled
2. Test Suite 44 OTEL tests passed (0 failed) — otel.test.js + otel-fanout.test.js
3. Env Var Forwarding api-proxy-service-config.ts forwards GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID; observability-environment.ts auto-forwards all OTEL_* vars to agent
4. Token Tracker Integration onUsage callback present in token-tracker-http.js (lines 283/324) as the OTEL hook point
5. OTEL Diagnostics ProxyAwareOtlpExporter implemented and tested; file fallback exporter present; no live spans (no Docker run in this workflow)

Result: All scenarios pass.

📡 OTel tracing validated by Smoke OTel Tracing

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test:
MCP connectivity: ✅
GitHub.com connectivity: ✅
File I/O: ✅
BYOK inference: ✅
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Overall: PASS
Cc @Copilot @lpcox

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3 ❌ NO
Node.js v24.16.0 v22.22.3 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color ok ✅ PASS
Go env ok ✅ PASS
Go uuid ok ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx All passed ✅ PASS
Node.js execa All passed ✅ PASS
Node.js p-limit All passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #5285 · 35.9 AIC · ⊞ 7.7K ·

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results: FAIL ❌

Check Result
Redis PING ❌ Timeout (no response)
PostgreSQL pg_isready ❌ No response (exit 2)
PostgreSQL SELECT 1 ❌ Timeout (no response)

Overall: FAILhost.docker.internal is not reachable from this runner. Services may not be configured or network routing to host services is unavailable in this environment.

🔌 Service connectivity validated by Smoke Services

@lpcox lpcox merged commit 6707484 into main Jun 19, 2026
86 of 90 checks passed
@lpcox lpcox deleted the copilot/refactor-initialization-phases branch June 19, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants